local skynet = require "skynet"
local tabletool = require "tabletool"
local msghelper = require "tablehelper"
local filelog = require "filelog"
local timer = require "timer"
local timetool = require "timetool"
require "fishenum"

local RoomSeatLogic = {}

function RoomSeatLogic.init(seatobj, index)
	seatobj.index = index
	seatobj.state = ESeatState.SEAT_STATE_NO_PLAYER
	seatobj.is_tuoguan = EBOOL.FALSE
	return true
end

function RoomSeatLogic.clear(seatobj)
	seatobj.rid = 0
	seatobj.state = 0  --改坐位玩家状态
	seatobj.playerinfo = {}
end

function RoomSeatLogic.is_empty(seatobj)
	return seatobj.state == ESeatState.SEAT_STATE_NO_PLAYER
end

function RoomSeatLogic.clear_seat(seat, conf)
	seat.rid = 0
	seat.state = ESeatState.SEAT_STATE_NO_PLAYER
	seat.playerinfo = {}
	seat.items = {}
	seat.is_tuoguan = EBOOL.FALSE
	seat.diamond = 0
	-- seat.entercarry = 0
	seat.currdiamond = 0
	seat.losediamond = 0
	seat.is_disconnect = nil
	seat.isrobot = nil
	seat.shootlevel = conf.baseshootlevel
	seat.shootstat = 0
	seat.shootcount = 0
	seat.launcher = nil
	seat.robot = nil
	if seat.disconnect_timer_id and seat.disconnect_timer_id > 0 then
		timer.cleartimer(seat.disconnect_timer_id)
		seat.disconnect_timer_id = -1
	end
	if seat.timer_id then
		timer.cleartimer(seat.timer_id)
		seat.timer_id = nil
	end
end

return RoomSeatLogic